// MESSAGE MAVLINK_COMM_CTRL support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief MAVLINK_COMM_CTRL message
 *
 * mavlink communication control
 */
struct MAVLINK_COMM_CTRL : mavlink::Message {
    static constexpr msgid_t MSG_ID = 172;
    static constexpr size_t LENGTH = 3;
    static constexpr size_t MIN_LENGTH = 3;
    static constexpr uint8_t CRC_EXTRA = 74;
    static constexpr auto NAME = "MAVLINK_COMM_CTRL";


    uint8_t comm_sw; /*<  comm switch. */
    uint8_t res1; /*<  res1 */
    uint8_t res2; /*<  res2 */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  comm_sw: " << +comm_sw << std::endl;
        ss << "  res1: " << +res1 << std::endl;
        ss << "  res2: " << +res2 << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << comm_sw;                       // offset: 0
        map << res1;                          // offset: 1
        map << res2;                          // offset: 2
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> comm_sw;                       // offset: 0
        map >> res1;                          // offset: 1
        map >> res2;                          // offset: 2
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
